$(function () {
    $("#submit").click(function () {
        var file = $("#file")[0].files[0];
        var formData = new FormData;
        formData.append("file",file);
        $.ajax({
            url:"http://localhost:8080/upload",
            type:"post",
            processData:false,
            contentType: false,
            data:formData,
            dataType:"json",
            success:function (result) {
                alert(result);
            }
        });
    });
});